unit RelatorioCRporPortador;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UFormRelatorio, DB, DBTables, QRCtrls, QuickRpt, ExtCtrls,
  StdCtrls;

type
  TFRelatorioCRtipodocumento = class(TFormRelatorio)
    QRGroup1: TQRGroup;
    QRDBText1: TQRDBText;
    QRLabel5: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRBand4: TQRBand;
    QRShape5: TQRShape;
    QRShape6: TQRShape;
    QRShape7: TQRShape;
    QRExpr5: TQRExpr;
    QRExpr6: TQRExpr;
    QRExpr1: TQRExpr;
    QRShape2: TQRShape;
    QRShape3: TQRShape;
    QRShape4: TQRShape;
    QRExpr2: TQRExpr;
    QRExpr3: TQRExpr;
    QRLabel14: TQRLabel;
    QRLabel15: TQRLabel;
    QRBand2: TQRBand;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRDBText5: TQRDBText;
    QRLHistorico1: TQRDBText;
    QRDBTvalor: TQRDBText;
    QRDBTpago: TQRDBText;
    QRDBTsaldo: TQRDBText;
    QRExpr7: TQRExpr;
    QRLSituacao: TQRLabel;
    QRLHistorico2: TQRDBText;
    QRLabel6: TQRLabel;
    QRLVencimento: TQRLabel;
    QRLDataVencimento: TQRLabel;
    QRLDocumento: TQRLabel;
    QRLDataDocumento: TQRLabel;
    QRLCentro: TQRLabel;
    QRLabel4: TQRLabel;
    procedure QRBand2BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRelatorioCRtipodocumento: TFRelatorioCRtipodocumento;
implementation

uses UGeral, PesquisaCRporVencimento;

{$R *.dfm}

procedure TFRelatorioCRtipodocumento.QRBand2BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  inherited;
  if FPesquisaContasReceber.QPesquisa.fieldByname('HISTORICO2').AsString <> '' then
  begin
    QRBand2.Height:=44;
    QRDBTvalor.Top:=QRLHistorico2.Top;
    QRDBTpago.Top:=QRLHistorico2.Top;
    QRDBTsaldo.Top:=QRLHistorico2.Top;
  end
  else
  begin
    QRBand2.Height:=23;
    QRDBTvalor.Top:=QRLHistorico1.Top;
    QRDBTpago.Top:=QRLHistorico1.Top;
    QRDBTsaldo.Top:=QRLHistorico1.Top;
  end;
end;

procedure TFRelatorioCRtipodocumento.FormCreate(Sender: TObject);
begin
  inherited;
 QRelatorio.Close;
 QRelatorio.SQL.Clear;
 QRelatorio.SQL.Add('Select Emp_Razao as Razao from empresa ');
 QRelatorio.SQL.Add('Where Emp_Codigo = :Cod ');
 QRelatorio.ParamByName('Cod').AsInteger:=Codigoempresa;
 QRelatorio.Open;
 QRLNomeEmpresa.Caption:=QRelatorio.fieldByname('Razao').AsString;

end;

end.
